<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateProductAttrValuesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('product_attr_values', function (Blueprint $table) {
            $table->id()->comment('商品单规格属性详情表');
            $table->integer('product_id')->index()->comment('商品id');
            $table->string('sku')->comment('商品属性索引值 (attr_value|attr_value[|....])');
            $table->integer('sales')->default(0)->comment('销量');
            $table->integer('stock')->default(0)->comment('库存');
            $table->decimal('price',8,2)->default(0)->comment('金额/售价(分)');
            $table->decimal('cost',8,2)->default(0)->comment('成本价(分)');
            $table->decimal('ot_price',8,2)->default(0)->comment('原价(分)');
            $table->string('image')->comment('图片');
            $table->string('bar_code')->comment('商品条码');
            $table->decimal('vip_price',8,2)->default(0)->comment('会员专享价(分)');
            $table->decimal('weight',8,2)->default(0)->comment('重量(克g)');
            $table->decimal('volume',8,2)->default(0)->comment('体积(立方厘米cm³)');
            $table->decimal('brokerage',8,2)->default(0)->comment('一级返佣(分)');
            $table->decimal('brokerage_two',8,2)->default(0)->comment('二级返佣(分)');
            $table->string('type' ,20)->default('noActivity')->comment('活动类型 noActivity : 普通商品，seckill : 秒杀，bargain : 砍价，combination : 拼团');
            $table->integer('quota')->default(0)->comment('活动限购数量');
            $table->integer('quota_show')->default(0)->comment('活动限购数量显示');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('product_attr_values');
    }
}


